{% load static %}
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>订餐系统后台管理</title>
  <!-- 支持响应式布局 -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="{% static 'myadmin/bower_components/bootstrap/dist/css/bootstrap.min.css' %}">
  <!-- 象形字体 -->
  <link rel="stylesheet" href="{% static 'myadmin/bower_components/font-awesome/css/font-awesome.min.css' %}">
  <!-- 图标 -->
  <link rel="stylesheet" href="{% static 'myadmin/bower_components/Ionicons/css/ionicons.min.css' %}">
  <!-- 主题风格样式 -->
  <link rel="stylesheet" href="{% static 'myadmin/dist/css/AdminLTE.min.css' %}">
  <!-- AdminLTE 皮肤.这里选择的是skin-blue样式，我们还可以有其他皮肤可以选择. -->
  <link rel="stylesheet" href="{% static 'myadmin/dist/css/skins/skin-blue.min.css' %}">
  <!-- 兼容IE9以下浏览器 -->
  <!--[if lt IE 9]>
  <script src="local/js/html5shiv.min.js"></script>
  <script src="local/js/respond.min.js"></script>
  <![endif]-->
  <!-- Google Font -->
  <link rel="stylesheet" href="{% static 'myadmin/local/css/google_fonts.css' %}">
  <style>
    .sidebar-menu>li {
      cursor: pointer;
    }
  </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper" id="vueObj">

  <!-- Main Header 主体页头 -->
  <header class="main-header">

    <!-- Logo -->
    <a href="index2.html" class="logo">
      <!-- 侧栏迷你徽标 mini 50x50 pixels -->
      <span class="logo-mini"><b>餐</b></span>
      <!-- 常规状态标志和移动设备标志 -->
      <span class="logo-lg"><b>订餐系统后台管理</b></span>
    </a>

    <!-- Header Navbar 首部导航栏 -->
    <nav class="navbar navbar-static-top" role="navigation">
      <!-- Sidebar toggle button 侧边栏切换按钮 -->
      <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
        <span class="sr-only">切换导航</span>
      </a>
      <!-- 右栏菜单 -->
      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">
          <!-- messages-menu 消息菜单: 样式可以在 dropdown.less 中找到 -->
          <li class="dropdown messages-menu">
            <!-- Menu toggle button 菜单切换按钮 -->
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <i class="fa fa-envelope-o"></i>
              <span class="label label-success">4</span>
            </a>
            <ul class="dropdown-menu">
              <li class="header">你有4个短信息</li>
              <li>
                <!-- 内部菜单：包含消息 -->
                <ul class="menu">
                  <li><!-- start message 信息开始 -->
                    <a href="#">
                      <div class="pull-left">
                        <!-- User Image 使用图片 -->
                        <img src="{% static 'myadmin/dist/img/user2-160x160.jpg' %}" class="img-circle" alt="User Image">
                      </div>
                      <!-- 消息标题和时间 -->
                      <h4>
                        我们都支持团队
                        <small><i class="fa fa-clock-o"></i> 5 分钟</small>
                      </h4>
                      <!-- The message -->
                      <p>Why not buy a new awesome theme?</p>
                    </a>
                  </li>
                  <!-- end message -->
                </ul>
                <!-- /.menu -->
              </li>
              <li class="footer"><a href="#">查看所有信息</a></li>
            </ul>
          </li>
          <!-- /.messages-menu -->

          <!-- Notifications Menu 通知菜单 -->
          <li class="dropdown notifications-menu">
            <!-- Menu toggle button  菜单切换按钮 -->
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <i class="fa fa-bell-o"></i>
              <span class="label label-warning">10</span>
            </a>
            <ul class="dropdown-menu">
              <li class="header">你有10条通知信息</li>
              <li>
                <!-- Inner Menu: contains the notifications -->
                <ul class="menu">
                  <li><!-- start notification -->
                    <a href="#">
                      <i class="fa fa-users text-aqua"></i> 今天有5名新成员加入
                    </a>
                  </li>
                  <!-- end notification -->
                </ul>
              </li>
              <li class="footer"><a href="#">查看全部</a></li>
            </ul>
          </li>
          <!-- Tasks Menu 任务菜单 -->
          <li class="dropdown tasks-menu">
            <!-- Menu Toggle Button 菜单切换按钮 -->
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <i class="fa fa-flag-o"></i>
              <span class="label label-danger">9</span>
            </a>
            <ul class="dropdown-menu">
              <li class="header">你有9个任务</li>
              <li>
                <!-- Inner menu: contains the tasks -->
                <ul class="menu">
                  <li><!-- Task item -->
                    <a href="#">
                      <!-- Task title and progress text -->
                      <h3>
                        设计一些按钮
                        <small class="pull-right">20%</small>
                      </h3>
                      <!-- The progress bar -->
                      <div class="progress xs">
                        <!-- Change the css width attribute to simulate progress -->
                        <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar"
                             aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                          <span class="sr-only">20% 完成</span>
                        </div>
                      </div>
                    </a>
                  </li>
                  <!-- end task item -->
                </ul>
              </li>
              <li class="footer">
                <a href="#">查看所有任务</a>
              </li>
            </ul>
          </li>
          <!-- User Account Menu -->
          <li class="dropdown user user-menu">
            <!-- Menu Toggle Button -->
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <!-- The user image in the navbar-->
              <img src="{% static 'myadmin/dist/img/user2-160x160.jpg' %}" class="user-image" alt="User Image">
              <!-- hidden-xs hides the username on small devices so only the image appears. -->
              <span class="hidden-xs">{{request.session.adminuser.nickname}}</span>
            </a>
            <ul class="dropdown-menu">
              <!-- The user image in the menu -->
              <li class="user-header">
                <img src="{% static 'myadmin/dist/img/user2-160x160.jpg' %}" class="img-circle" alt="User Image">

                <p>
                  {{request.session.adminuser.nickname}} - 管理员
                  <small>{{request.session.adminuser.create_at}}加入</small>
                </p>
              </li>
              <!-- Menu Footer-->
              <li class="user-footer">
                <div class="pull-left">
                  <a href="#" class="btn btn-default btn-flat">个人信息</a>
                </div>
                <div class="pull-right">
                  <a href="{% url 'myadmin_logout' %}" class="btn btn-default btn-flat">退 出</a>
                </div>
              </li>
            </ul>
          </li>
          
        </ul>
      </div>
    </nav>
  </header>

  <!-- 左侧柱。包含徽标和边栏 -->
  <aside class="main-sidebar">

    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">

      <!-- Sidebar user panel (optional) -->
      <div class="user-panel">
        <div class="pull-left image">
          <img src="{% static 'myadmin/dist/img/user2-160x160.jpg' %}" class="img-circle" alt="User Image">
        </div>
        <div class="pull-left info">
          <p>{{request.session.adminuser.nickname}} . 管理员</p>
          <!-- Status -->
          <a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
        </div>
      </div>

      <!-- Sidebar Menu -->
      
        <ul class="sidebar-menu" data-widget="tree">
          <li class="header">主要导航</li>
          <!-- 导航列表，你可以自行更改图标 -->
          {% verbatim myblock %}<li :class="{'active': url=='myadmin' }">{% endverbatim myblock %}<a @click="getUrl('myadmin')"><i class="fa fa-home"></i> <span>首页</span></a></li>
          
          {% verbatim myblock %}<li :class="{'active': url=='user' }">{% endverbatim myblock %}<a @click="getUrl('user')"><i class="fa fa-users"></i> <span>员工管理</span></a></li>
          {% verbatim myblock %}<li :class="{'active': url=='shop' }">{% endverbatim myblock %}<a @click="getUrl('shop')"><i class="fa fa-sitemap"></i> <span>店铺管理</span></a></li>
          <li class="treeview" :class="{'active': url=='category'||url=='product' }">
            <a @click="getUrl('category')"><i class="fa fa-cutlery"></i> <span>菜品管理</span>
              <span class="pull-right-container">
                <i class="fa fa-angle-left pull-right"></i>
              </span>
            </a>
            <ul class="treeview-menu">
              {% verbatim myblock %}<li :class="{'active': url=='category' }">{% endverbatim myblock %}<a @click="getUrl('category')"> <i class="fa fa-circle-o"></i> 菜品分类</a></li>
              {% verbatim myblock %}<li :class="{'active': url=='product' }">{% endverbatim myblock %}<a @click="getUrl('product')"> <i class="fa fa-circle-o"></i> 菜品信息</a></li>
            </ul>
          </li>
          {% verbatim myblock %}<li :class="{'active': url=='member' }">{% endverbatim myblock %}<a @click="getUrl('member')"><i class="fa fa-users"></i> <span>会员管理</span></a></li>
        </ul>
      
      <!-- /.sidebar-menu -->
    </section>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    {% block main_body %}
    {% endblock %}
  </div>
  <!-- /.content-wrapper -->

  <!-- Main Footer -->
  <footer class="main-footer">
    <!-- To the right -->
    <div class="pull-right hidden-xs">
      <!--餐饮管理平台-->
    </div>
    <!-- Default to the left -->
    <strong>Copyright &copy; 2020 <a href="#">北京****有限公司</a>.</strong> 版权所有
  </footer>

  <!-- 添加侧栏的背景。必须放置此处紧接在控制侧边栏之后 -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<!-- edu-model提示框模板 -->
<div id="edu-alert" class="modal">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
        <h5 class="modal-title"><i class="fa fa-exclamation-circle"></i> [Title]</h5>
      </div>
      <div class="modal-body small">
        <p>[Message]</p>
      </div>
      <div class="modal-footer" >
        <button type="button" class="btn btn-primary ok" data-dismiss="modal">[BtnOk]</button>
        <button type="button" class="btn btn-default cancel" data-dismiss="modal">[BtnCancel]</button>
      </div>
    </div>
  </div>
</div>
<!-- edu-model-end -->

<!-- REQUIRED JS SCRIPTS -->
  
<!-- jQuery 3 -->
<script src="{% static 'myadmin/bower_components/jquery/dist/jquery.min.js' %}"></script>
<!-- Bootstrap 3.3.7 -->
<script src="{% static 'myadmin/bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
<!-- AdminLTE App -->
<script src="{% static 'myadmin/dist/js/adminlte.min.js' %}"></script>

<script src="{% static 'myadmin/dist/js/edu-modal-alert-confirm.js' %}"></script>

<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>

<!-- 此处可以添加SimLoopl和FastClick插件，用于增强用户体验。 -->


<script type="text/javascript">
	function doDel(url) {
    console.log(url);
    Modal.confirm({
      msg: "确定要删除吗？",
      title: ' 信息提示',
      btnok: '确定',
      btncl:'取消'
    }).on(function (e){
      if(e){
        window.location.href = url;
      }
    });
  }
  
  function getQUrl() {
    let qUrl = document.URL
    let laststr = qUrl.lastIndexOf('/')
    let laststr1= qUrl.lastIndexOf('/',qUrl.lastIndexOf('/')-1);
    return qUrl.substring(laststr1+1,laststr)
  }
  // function getQUrl() {
  //   var reqUrl='{{ request }}'
  //   return reqUrl.substring(reqUrl.lastIndexOf('/',reqUrl.lastIndexOf('/')-1)+1,reqUrl.lastIndexOf('/'))
  // }
  $(function() { 
    var vm = new Vue({
      el: '#vueObj',
      data: {
        url: getQUrl()
      },
      methods: {
        getUrl(url) {
          console.log(url);
          if (url=='myadmin') {
            this.url = 'myadmin';
            window.location.href = '/myadmin';
          } else if (url == 'user') {
            this.url = 'user';
            window.location.href = '/myadmin/user/1';
          } else if (url == 'shop') {
            this.url = 'shop';
            window.location.href = '/myadmin/shop/1';
          } else if (url == 'category') {
            this.url = 'category';
            window.location.href = '/myadmin/category/1';
          } else if (url == 'product') {
            this.url = 'product';
            window.location.href = '/myadmin/product/1';
          } else if (url == 'member') {
            this.url = 'member';
            window.location.href = '/myadmin/member/1';
          }
        }
      },
    })
  })
  
</script>
{% block loadjavascript %}
{% endblock %}
</body>
</html>